home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
- Object = "{0DE92B77-C272-11D1-82B4-E5132F8CF155}#8.0#0"; "csstray.ocx"
- Begin VB.Form frmEx2
- Caption = "SysTray Example Application #2"
- ClientHeight = 3255
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 5295
- Icon = "frmEx2.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 3255
- ScaleWidth = 5295
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin csSysTrayCtl.csSysTray csSysTray1
- Left = 4080
- Top = 2040
- _ExtentX = 2064
- _ExtentY = 1111
- TrayIcon = "frmEx2.frx":0442
- TrayTip = "Click this icon to zoom the window to/from the system tray!"
- p_RegCode = "frmEx2.frx":0894
- End
- Begin VB.CommandButton cmdAnimate
- Caption = "Animate Icon"
- Height = 375
- Left = 2040
- TabIndex = 4
- Top = 2760
- Width = 1575
- End
- Begin VB.CommandButton cmdZoomToTray
- Caption = "&Zoom to Tray"
- Height = 375
- Left = 120
- TabIndex = 3
- Top = 2760
- Width = 1695
- End
- Begin VB.CommandButton cmdClose
- Cancel = -1 'True
- Caption = "&Close"
- Height = 375
- Left = 4080
- TabIndex = 1
- Top = 2760
- Width = 1095
- End
- Begin ComctlLib.ImageList ImageList1
- Left = 2520
- Top = 2040
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 327682
- BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7}
- NumListImages = 7
- BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":08B4
- Key = ""
- EndProperty
- BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":0BCE
- Key = ""
- EndProperty
- BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":0EE8
- Key = ""
- EndProperty
- BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":1202
- Key = ""
- EndProperty
- BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":151C
- Key = ""
- EndProperty
- BeginProperty ListImage6 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":1836
- Key = ""
- EndProperty
- BeginProperty ListImage7 {0713E8C3-850A-101B-AFC0-4210102A8DA7}
- Picture = "frmEx2.frx":1B50
- Key = ""
- EndProperty
- EndProperty
- End
- Begin VB.Label Label1
- Caption = $"frmEx2.frx":1E6A
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 660
- Left = 120
- TabIndex = 5
- Top = 1440
- Width = 5055
- End
- Begin VB.Image Image1
- Height = 480
- Left = 120
- Picture = "frmEx2.frx":1F06
- Top = 2160
- Width = 480
- End
- Begin VB.Label Label4
- Caption = $"frmEx2.frx":2348
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 780
- Left = 120
- TabIndex = 2
- Top = 600
- Width = 5055
- End
- Begin VB.Label Label3
- Caption = "This example application shows just how easy it is to use the SysTray control in your own application."
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 5055
- End
- Attribute VB_Name = "frmEx2"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- 'Example program for SysTray Control
- '(C) Copyright 1998 Charon Software, All Rights Reserved
- 'You may use or modify this code in any way you see fit.
- 'Charon Software takes no responsibility for what you may
- 'do with this or any modification of this code.
- 'Please note that the ShowInTaskbar property of this form
- 'is False; if it weren't, the window would zoom to the
- 'system tray and then the taskbar icon would disappear.
- 'It is designed to work either way.
- 'Also note that zooming the window to the system tray does
- 'not actually minimize the window: it just hides it.
- Private Sub cmdAnimate_Click()
- 'we change the caption on the command button to let the
- 'user simply click it to start (and then stop) the
- 'animation. ImageList1 is the imagelist we have on our
- 'form, with the icons for the animation. 120 is the
- 'number of milliseconds to pause between each frame.
- If cmdAnimate.Caption = "Animate Icon" Then
- csSysTray1.StartAnimation ImageList1, 120
- cmdAnimate.Caption = "Stop Animation"
- Else
- csSysTray1.StopAnimation
- cmdAnimate.Caption = "Animate Icon"
- End If
- End Sub
- Private Sub cmdClose_Click()
- 'pretty simple, just unload my form. The system tray
- 'icons will go away automatically!
- Unload Me
- End Sub
- Private Sub cmdZoomToTray_Click()
- 'zoom the window to the system tray.
- csSysTray1.ZoomToTray Me.hWnd
- End Sub
- Private Sub csSysTray1_Click()
- 'when the user clicks on the system tray icon, we
- 'want to zoom the window to/from the system tray.
- 'note: when we zoom the window to/from the tray, we
- 'simply hide or show it, respectively. We do not
- 'change its WindowState property nor unload it.
- If Me.Visible = False Then
- csSysTray1.ZoomFromTray Me.hWnd
- Else
- csSysTray1.ZoomToTray Me.hWnd
- End If
- End Sub
- Private Sub Form_Load()
- csSysTray1.AddMinimizeWatch Me.hWnd 'if a user presses "my" minimize button,
- 'I want to zoom to tray instead.
- 'Also, I could remove myself in my unload
- 'event, although it isn't necessary.
- 'Visual Basic and the SysTray control do it
- 'all automatically for you upon unload!
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- ' we could remove our "minimize watch" like the following, but we don't need to.
- ' csSysTray1.RemoveMinimizeWatch Me 'see Form_Load -- not necessary.
- 'for added effect, we'll zoom to the tray on exit
- csSysTray1.ZoomToTray Me.hWnd
- End Sub
-